<?php

class JqGridNavigator extends CComponent {

    protected $grid;
    public $prmEdit = array();
    public $prmAdd = array();
    public $prmDel = array();
    public $prmSearch = array();
    public $prmView = array();
    public $options = array();

    /**
     * Constructor.
     * @param CGridView the grid view that owns this column.
     */
    public function __construct($grid) {
        $this->grid = $grid;
    }

    /**
     * Initializes the column.
     */
    public function init() {
//        if ($this->name === null)
//            $this->sortable = false;
//        if ($this->name === null && $this->value === null)
//            throw new CException(Yii::t('jqgrid', 'Either "name" or "value" must be specified for JqGridDataColumn.'));
//        //{name:'id',index:'id', width:60, sorttype:"int"},
    }

    public function registerClientScript() {
        $pager_id = str_replace("#", "", $this->grid->options['pager']);
        foreach(get_object_vars($this) as $key=>$value){
            if($key == 'grid')continue;
            $options[$key] = $this->$key;
        }
        $options = CJavaScript::encode($options);
        Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $pager_id, "jQuery('#".$this->grid->getId()."').jqGrid('navGrid','#$pager_id', $options);");
    }

}
